import translations from "./translations";

export default function customTranslate(
  template: string,
  replacements: Record<string, string>
): string {
  console.log("template", template);
  console.log("replacements", replacements);
  replacements = replacements || {};
  // Translate
  template = translations[template] || template;
  // Replace
  return template.replace(/{([^}]+)}/g, function (_, key) {
    return replacements[key] || "{" + key + "}";
  });
}
